package thread;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: xiaotutu
 * Date: 2025-02-20
 * Time: 15:29
 */

// 使用一下阻塞队列
public class Demo18 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new LinkedBlockingQueue<>();

        queue.put("hello");
        String elem = queue.take();
        System.out.println("elem =" + elem);
        elem = queue.take();
        System.out.println("elem =" + elem);
    }
}
